<!doctype html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<title>Tendências de Faturamento - Ameaças</title>
		
		<%@ include file="head.jsp" %>
		
		<script type="text/javascript" src="resources/js/moeda.js"></script>
		
		<link rel="stylesheet" href="resources/css/jquery-ui.css" type="text/css" media="all" />
		<link rel="stylesheet" href="resources/css/ui.theme.css" type="text/css" media="all" />
		<script src="resources/js/jquery-ui.min.js" type="text/javascript"></script>
		<script src="resources/js/jquery.bgiframe-2.1.2.js" type="text/javascript"></script>
		<script src="resources/js/jquery-ui-i18n.min.js" type="text/javascript"></script>
		
		<script>
			$(function() {
				$.datepicker.regional['pt-BR'] = {
		                closeText: 'Fechar',
		                prevText: '&#x3c;Anterior',
		                nextText: 'Pr&oacute;ximo&#x3e;',
		                currentText: 'Hoje',
		                monthNames: ['Janeiro','Fevereiro','Mar&ccedil;o','Abril','Maio','Junho',
		                'Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'],
		                monthNamesShort: ['Jan','Fev','Mar','Abr','Mai','Jun',
		                'Jul','Ago','Set','Out','Nov','Dez'],
		                dayNames: ['Domingo','Segunda-feira','Ter&ccedil;a-feira','Quarta-feira','Quinta-feira','Sexta-feira','Sabado'],
		                dayNamesShort: ['Dom','Seg','Ter','Qua','Qui','Sex','Sab'],
		                dayNamesMin: ['Dom','Seg','Ter','Qua','Qui','Sex','Sab'],
		                weekHeader: 'Sm',
		                dateFormat: 'mm/yy',
		                firstDay: 0,
		                isRTL: false,
		                showMonthAfterYear: false,
		                yearSuffix: ''};
		        $.datepicker.setDefaults($.datepicker.regional['pt-BR']);
		        
				$( "#dataInicial" ).datepicker();
				$( "#dataFinal" ).datepicker();
			});
		</script>
		
		<script type="text/javascript">
			function permanenteChanged( checkbox )
			{
				var dataFinalField = document.getElementById("dataFinal");
				
				if( checkbox.checked )
				{
					dataFinalField.disabled="disabled";
				}
				else {
					document.getElementById("dataFinal").text = "";
					dataFinalField.disabled="";
				}
			} 
		</script>
		
		<style type="text/css">
	      .form-class label {
	      	width:170px;float:left;display:block;
	      }
	    </style>
	    
		<script type="text/javascript">
		
		  var _gaq = _gaq || [];
		  _gaq.push(['_setAccount', 'UA-35513738-1']);
		  _gaq.push(['_trackPageview']);
		
		  (function() {
		    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
		    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
		    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
		  })();
		
		</script>		
	    
	</head>
<body>
	<%@ include file="menu.jsp" %>

    <div class="container-fluid">
    	<div class="row-fluid">
			
			<div class="page-header"><h1>Cadastro de Ameaça</h1></div>
			
			<c:if test="${mensagemSucesso != null}">
				<div class="alert alert-info" style="text-align: center;">${mensagemSucesso}</div>  			
  			</c:if>
			
			<form:form method="post" action="declinio" modelAttribute="declinio" class="form-class">
			
				<form:label path="idEntidade">Entidade:</form:label>
				<form:select path="idEntidade" items="${entidades}" itemLabel="nome" itemValue="id" /><br/>
			
				<form:label path="nome">Nome:</form:label>
                <form:input path="nome" /><br/>

                <form:label path="dataInicial">Período:</form:label>
                <form:input path="dataInicial" style="width: 88px" maxlength="7" autocomplete="false" id="dataInicial" />&nbsp;&nbsp;a&nbsp;
                <form:input path="dataFinal" style="width: 88px" maxlength="7" autocomplete="false" id="dataFinal" />&nbsp;
                <input type="checkbox" name="permante" id="permante" onchange="permanenteChanged(this);" />
                Permanente
                <br/>
			
				<form:label path="porcentagem">Taxa de Declínio:</form:label>
                <form:input path="porcentagem" autocomplete="false" maxlength="30" onkeypress="reais(this,event)" onkeydown="backspace(this,event)" />&nbsp;&nbsp;(%)<br/>
                
                <br/>
                
                <div class="btn btn-primary btn-large" onclick="window.location.href='declinio'" >Voltar</div>
                <input type="submit" class="btn btn-primary btn-large" value="Salvar" />
			
			</form:form>

		</div>
		<%@ include file="rodape.jsp" %>
	</div>
</body>
</html>

